﻿@using BOSS.Web.Extensions;
@model BOSS.Domain.Security.Account           

@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head runat="server">
    <title>登录</title>
    <style type="text/css">
        #login .x-form-text {
            height: 30px;
        }
        #login .x-form-item .x-form-item-label {
            font-size: 18px;
        }
        #login .x-btn-text {
            height: 30px;
        }
        #login .x-btn button {
            font-size: 18px;
        }
    </style>
    <link href="@Url.Content("~/favicon.ico")" rel="shortcut icon"/>
    <link href="@Url.Content("~/favicon.ico")" rel="icon"/>
    <link type="text/css" rel="Stylesheet" href="@Url.Content("~/Content/extjs/css/ext-all.css")" />
    <script type="text/javascript" src="@Url.Content("~/Scripts/extjs/adapter/ext/ext-base.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/extjs/ext-all.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/extjs/locale/ext-lang-zh_CN.js")"></script>
    <script type="text/javascript">
        function refreshVerifyImage(){
            var vi = document.getElementById('verifyImage');
		    if (typeof(vi.originSrc) == "undefined") {
		        vi.originSrc = vi.src;
            }
		    vi.src = vi.originSrc + '?r=' + Math.random();
        }
        
        Ext.onReady(function() {
            var txtLoginName = new Ext.form.TextField({
                name: 'LoginName',
                fieldLabel: '用户名',
                width: 250
            });
            
            var txtPassword = new Ext.form.TextField({
                name: 'Password',
                fieldLabel: '密码',
                inputType: 'password',
                width: 250
            });
            
            var txtVerifyCode = new Ext.form.TextField({
                name: 'VerifyCode',
                fieldLabel: '验证码',
                width: 100
            });

            var row = function(cols) {
                return {
                    layout: 'column', 
                    border: false,
                    defaults: { border: false, layout: 'form', labelWidth: 100 },
                    items: cols
                };
            };
            var formPanel = new Ext.form.FormPanel({
                renderTo: 'login',
                border: true,
                frame: true,
                padding: '55px 55px 20px 55px',
                width: 500,
                height: 250,
                buttonAlign: 'center',
                standardSubmit: true,
                buttons: [
                    { text: '登 录', width: 100, type: 'submit', handler: function() { 
                        var form = formPanel.getForm();
                        if (form.isValid()) {
                            form.submit({ url: '<%= Url.Action("Login", "Account") %>' });
                        }
                    }}, 
                    { text: '取 消', width: 100, handler: function() { formPanel.getForm().reset(); } }
                ],
                items: [ 
                    new row([{ items: [txtLoginName] }]),
                    new row([{ items: [txtPassword] }]),
                    new row([{ items: [txtVerifyCode] },{ items: [{ html: '<a  style="margin:5px;" title="点击刷新验证码" href="javascript:refreshVerifyImage();"><img id="verifyImage" alt="[请稍等]" src="@Url.Content(string.Format("~/Content/images/VerifyImage.ashx?r={0}", DateTime.Now.Ticks))" /></a>', width: 80 }] } ])
                ]
            });
            
@if (Model != null)
{
    @Html.ExtSetValues(new Dictionary<string, object>(){
        { "txtLoginName", Model.LoginName}
    })      
}   

    @Html.ExtValidationMessage(new Dictionary<string, string>(){
        { "loginName", "txtLoginName"},
        { "password", "txtPassword"},
        { "verifyCode", "txtVerifyCode"}
    })
      
        });
    </script>
</head>
<body>
    <div id="login" style="width: 400px; margin:200px auto 0 auto;">
    
    </div>
</body>
</html>
